package com.example.kiratest.EasyExcel.pojo;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum ExcelImportExportEnum {

    //完整信息
    PILOT_ENTERPRISE("PILOT_ENTERPRISE","试点企业信息.xlsx", "templates/pilotEnterprise.xlsx"),

    ;

    //模板编码
    private String code;

    //文件名称
    private String name;

    //文件存储路径
    private String path;

    ExcelImportExportEnum(String code, String name, String path) {
        this.code = code;
        this.name = name;
        this.path = path;
    }

    public static ExcelImportExportEnum getByCode(String templateCode) {
        for (ExcelImportExportEnum item : ExcelImportExportEnum.values()) {
            if (Objects.equals(templateCode, item.getCode())) {
                return item;
            }
        }
        throw new IllegalArgumentException("模板编码不存在：" + templateCode);
    }
}